IF NOT EXISTS(SELECT name FROM sysobjects  WHERE name = 'OrganizationsCreditPaper')
BEGIN 
CREATE TABLE [dbo].[OrganizationsCreditPaper](
	[Id] [uniqueidentifier] NOT NULL,
	[SerialNumber] [nvarchar](max) NULL,
	[ValidityDate] [smalldatetime] NULL,
	[CreditAmount] [money] NULL,
	[DeliverDate] [datetime] NULL,
	[CreatedBy] [smallint] NULL,
	[InvoiceId] [numeric](18, 0) NULL,
	[ClubId] [int] NULL,
	[ReciveCode] [varchar](5) NULL,
	[UsedOn] [datetime] NULL,
	[Status] [tinyint] NULL,
 CONSTRAINT [PK_OrganizationsCreditPaper] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
) ON [PRIMARY]
) ON [PRIMARY] 

ALTER TABLE [dbo].[OrganizationsCreditPaper] ADD  CONSTRAINT [DF_OrganizationsCreditPaper_Id]  DEFAULT (newid()) FOR [Id]


ALTER TABLE [dbo].[OrganizationsCreditPaper] ADD  CONSTRAINT [DF_OrganizationsCreditPaper_DeliverDate]  DEFAULT (getdate()) FOR [DeliverDate]


ALTER TABLE [dbo].[OrganizationsCreditPaper] ADD  CONSTRAINT [DF_Table_1_IsUsed]  DEFAULT ((0)) FOR [Status]
end